home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1122 / 1122.xpi / chrome / tabmixplus.jar / content / tabmixplus / minit / autoReload.xul next >
Extensible Markup Language  |  2009-10-02  |  4KB  |  105 lines

  1. <?xml version="1.0"?>
  2.  
  3. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  4.  
  5. <!DOCTYPE dialog [
  6. <!ENTITY % tabmixDTD SYSTEM "chrome://tabmixplus/locale/tabmix.dtd" >
  7. %tabmixDTD;
  8. <!ENTITY % miscDTD SYSTEM "chrome://tabmixplus/locale/misc.dtd" >
  9. %miscDTD;
  10. ]>
  11.  
  12. <dialog id="reloadevery_custom_dialog"
  13.         title="&specifyreload.label;"
  14.         buttons="accept,cancel"
  15.         ondialogaccept="window.arguments[0](true);  return accept();"
  16.         ondialogcancel="window.arguments[0](false); return true;"
  17.         onload="load();"
  18.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  19.  
  20. <script type="application/x-javascript"><![CDATA[
  21.  
  22. var gPref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch2);
  23.  
  24. function load(){
  25.  
  26.     var customReloadTime = gPref.getIntPref("extensions.tabmix.custom_reload_time");
  27.  
  28.     document.getElementById("autoreload_minutes").value = Math.floor(customReloadTime / 60);
  29.     document.getElementById("autoreload_seconds").value = customReloadTime % 60;
  30.     disable_OK();
  31. }
  32.  
  33. function accept() {
  34.     var customReloadTime = getCustomReloadTime();
  35.     gPref.setIntPref("extensions.tabmix.custom_reload_time", customReloadTime);
  36.     gPref.setIntPref("extensions.tabmix.reload_time", customReloadTime);
  37.  
  38.     return true;
  39. }
  40.  
  41. function getCustomReloadTime() {
  42.     var minutes;
  43.     if(document.getElementById("autoreload_minutes").value != ''){
  44.       minutes = parseInt(document.getElementById("autoreload_minutes").value);
  45.     }
  46.     else{
  47.       minutes = 0;
  48.     }
  49.  
  50.     var seconds;
  51.     if(document.getElementById("autoreload_seconds").value != ''){
  52.       seconds = parseInt(document.getElementById("autoreload_seconds").value);
  53.     }
  54.     else{
  55.       seconds = 0;
  56.     }
  57.     return minutes*60 + seconds;
  58. }
  59.  
  60. function disable_OK() {
  61.    document.documentElement.getButton("accept").disabled = getCustomReloadTime() == 0;
  62. }
  63.  
  64. ]]></script>
  65.  
  66.   <groupbox orient="horizontal" align="center">
  67.     <caption label="&reloadtime.label1;" />
  68.     <menulist id="autoreload_minutes" editable="true"
  69.              oncommand="disable_OK();"
  70.              oninput="this.value=parseInt(this.value);
  71.                       if (this.value=='NaN') this.value='';
  72.                       if (Number(this.value) < 0) this.value = -this.value;
  73.                       disable_OK();">
  74.              <menupopup>
  75.                   <menuitem value="0" label="0" />
  76.                   <menuitem value="1" label="1" />
  77.                   <menuitem value="5" label="5"/>
  78.                   <menuitem value="10" label="10"/>
  79.                   <menuitem value="15" label="15" />
  80.                   <menuitem value="20" label="20"/>
  81.                   <menuitem value="30" label="30"/>
  82.              </menupopup>
  83.     </menulist>
  84.     <label control="autoreload_minutes" value="&minutes.label;"/>
  85.  
  86.     <menulist id="autoreload_seconds" editable="true"
  87.              oncommand="disable_OK();"
  88.              oninput="this.value=parseInt(this.value);
  89.                       if (this.value=='NaN') this.value='';
  90.                       if (Number(this.value) < 0) this.value = -this.value;
  91.                       if (Number(this.value) > 59) this.value = 59;
  92.                       disable_OK();">
  93.              <menupopup>
  94.                   <menuitem value="0" label="0" />
  95.                   <menuitem value="10" label="10" />
  96.                   <menuitem value="20" label="20"/>
  97.                   <menuitem value="30" label="30"/>
  98.                   <menuitem value="45" label="45" />
  99.              </menupopup>
  100.     </menulist>
  101.     <label control="autoreload_seconds" value="&seconds.label;"/>
  102.   </groupbox>
  103.  
  104. </dialog>
  105.